package com.dyp.listenerdemo.web.rest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/test")
public class TestResource {
    @GetMapping("/listener")
    public String hello(HttpServletRequest request) {
        request.getSession(); //session的创建触发，调用后Session Listener会触发
        String param = request.getAttribute("abcKey").toString();
        return "hello world! " + param;
    }
}
